package cn.tedu.csmall.passport.controller;

import cn.tedu.csmall.passport.pojo.vo.RoleListVO;
import cn.tedu.csmall.passport.service.RoleService;
import cn.tedu.csmall.commons.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.Range;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/role")
@Api(tags = "05.角色管理模块")
@Slf4j
@Validated
public class RoleController {

    @Autowired
    RoleService service;


    @GetMapping("/list")
    @PreAuthorize("hasAuthority('/ams/admin/read')")
    @ApiOperation("查看角色列表")
    @ApiOperationSupport(order = 500)
    public JsonResult list(){
        List<RoleListVO> list = service.list();
        return JsonResult.ok(list);
    }



}
